﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using Common;

public partial class Customer_Notice_Add : System.Web.UI.Page
{

    protected string MenuType
    {
        get { return string.IsNullOrEmpty(Request["menutype"]) ? "" : Request["menutype"].ToString(); }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
       if (!this.IsPostBack)
       {

       }
    }

    //添加
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string[] ReceiverKeyArr = txt_ReceiverKeyList.Value.Split(',');

        try
        {
            for (int i = 0; i < ReceiverKeyArr.Length; i++)
            {
                Dat_Notice notice = new Dat_Notice
                {
                    Title = txt_Title.Text.Trim(),
                    NContent = txt_NContent.Text.Trim(),
                    Receiver = Convert.ToInt32(ReceiverKeyArr[i]),
                    Sender = Convert.ToInt32(Session["UserKey"]),
                    SendTime = DateTime.Now,
                    IsRead = "否"
                };
                new Notice().AddNotice(notice);
            }
            WebUtility.JsAlertToGo("发送消息成功", "Notice_Add.aspx?menutype=451");
        }
        catch (Exception ex)
        {

            WebUtility.JsAlertToGo("发送消息失败", "Notice_Add.aspx?menutype=451");
        }
    }
}
